<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        *{
            margin: 0;
        }
        .header-main{
            width: 300px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            background-color: #f3f3f3;
        }
        .header-main img{
            width: 50px;
            height: 50px;
        }
    </style>
</head>
<body>
    <div id="app"></div>
<script>
    let headerCom = {
        template:`
        <div class="header-main">
            <img scr='./头像.jpg'> 
            <div>
                <slot name="center"></slot>
            </div>
            <div>
                <slot name="right"></slot>
            </div>
        </div>
        `,
    } 

    let News={
        template:`
        <div>
            <header-com>
                <p slot="center">动态</p>
                <p slot="right">图标1</p>
            </header-com>
        </div>
    `,
    components:{'header-com':headerCom},
}
let Person = {
    template:`
    <div>
        <header-com>
            <p slot="center">联系人</p>
            <p slot="right">图标2</p>
        </header-com>
    </div>
    `,
    components:{'header-com':headerCom}
}
    let App = {
    template:`
        <div>
            新闻组件
           <News></News>
           <br>
           <br>
           联系人组件:
           <person></person>
        </div>
    `,
    components:{News,Person },
}
    new Vue({
        render: h => h(App)
    }).$mount("#app")
</script>
</body>
</html>